package org.wejob.web.buffer;

public class SocketReadBufferQueue extends AsynchronousQueue<WebIOBuffer> {

    public SocketReadBufferQueue() {
        super.init();
    }

    @Override
    protected WebIOBuffer getWhileIsEmpty() {
        return null;
    }


    public void put(WebIOBuffer node) {
        if (node.isEmpty())
            throw new RuntimeException("read buffer is empty");
        if (!super.offer(node))
            throw new RuntimeException("put fail");
    }

    //异步读
    public WebIOBuffer asyncGet() {
        return super.poll();
    }

    //todo 阻塞读--读不到就挂起线程--当前版本不实现
    public WebIOBuffer syncGet() {
        return null;
    }
}
